<?php

global $tax;
global $page;

get_header(); ?>
<?php get_menu(); ?>
<?php 
    //var_dump(get_query_var("page"));
	$page = ((get_query_var("page") != '')? get_query_var("page") : 1);
	$s = get_query_var("s");

	//$page = 2;
    //var_dump($page);
	$agrs = array(
            /* lấy theo trang hiện tại */
			'paged' => $page,
			
            /* số bài post ở mỗi trang */
            'showposts' => product_paging,

            /* chỉ lấy post dạng product */
            'post_type' => 'product',

            's' => $s

		);
?>

<?php $tax = new WP_Query(); ?>
<?php //var_dump($post); ?>
<?php $tax->query($agrs); ?>
<?php //var_dump($tax); ?>
<!-- Begin #shop-main-content -->
<div id="shop-main-content">

    <div  class="pagination pagination-top">
        <!-- hàm này trong function.php -->
        <?php get_paging(); ?>
    </div>

    <!-- Begin product-item-->
    <ul id="list-product" class="clearfix">
        <?php //var_dump($tax); ?>
        <?php $c = 0; ?>

        <?php while ( $tax->have_posts() ) : $tax->the_post(); ?>

        <?php //lay content tu archive-product ?>

        <?php woocommerce_get_template_part( 'content', 'product' ); ?>

        <?php $c++; ?>

        <?php if($c >= 3){
            echo "<div class='clearfix'></div>";
            $c = 0;
        }?>
        <?php endwhile; // end of the loop. ?>

    </ul>

    <!-- End product-item-->

    <!--Begin .pagination pagination-bottom-->
    <div class="pagination pagination-bottom">
        <!-- hàm này trong function.php -->
        <?php get_paging(); ?>
    </div>
    <!--End .pagination pagination-bottom-->

    </div>
    <!-- End #shop-main-content -->

<?php get_footer('shop'); ?>

<div id="modal-box" class="modal-box popup-catalogue-show">
    <div id="modal-box-inner">
        <div class="row clearfix">
            <div class="slider">
                <div class="slider-wrapper theme-default">
                    <div class="row modal-slider">
                        <img src="" alt="">
                    </div>
                </div>
            </div>
            <div class="info">
                <div class="tooltip">
                    <ul>
                        <li class="add_to_cart_btn">Thêm vào giỏ hàng</li>
                        <li class="add_to_cart_btn_clicked">Đặt hàng</li>
                    </ul>
                </div>
                <div id="slider-info"></div>
            </div>
        </div>

        <div class="row list-image">

        </div>
    </div>